import os
from common.iniconfig import iniconfig

a=iniconfig(os.curdir+os.sep+"settings")

def getlang():
        temp={}
        for m in os.listdir("locale/"):
                if os.path.exists("locale/%s/LC_MESSAGES/lang.mo" % m) and os.path.exists("locale/%s/LC_MESSAGES/lang" % m):
                        temp2=open("locale/%s/LC_MESSAGES/lang" % m,"r")
                        temp[m]=temp2.read()
                        temp2.close()
        return temp

def set_default_lang(str):
        a.set_item("default_lang",str)
        
def get_default_lang():
        return a.get_item("default_lang")
        